home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / library / dfnc3714.lha / dfunc_library / sources / asm / StripCom.S < prev   
Text File  |  1995-10-01  |  4KB  |  191 lines

  1. *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  2. *      Name    > StripCom 1.0
  3. *
  4. *     Synopsis    > This sub routine will remove comments in a ascii text
  5. *
  6. *     Function    > library sub routine
  7. *
  8. *    Inputs    > a0 - pointer to text buffer
  9. *          a1 - pointer to destination buffer
  10. *    Result    > stripped buffer
  11. *
  12. *     Notes    > used to interpertate ascii command language
  13. *          PUBLIC DOMAIN WITH THE DFUNC ARCHIVE!!
  14. *      Bugs    > 
  15. *
  16. *      Created    > 30.9.95
  17. *  Last change    > 30.9.95
  18. *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  19.  
  20. *## For the Startup.asm:
  21.  
  22. StartSkip    =    0        ;0=WB/CLI, 1=CLI only  (AsmOne)
  23. Processor    =    0        ;0/680x0
  24. MathProc    =    0        ;0/68881/68882/68040
  25.  
  26. *## Default includes:
  27.  
  28.         Incdir
  29.  
  30.         Include    lvo:Exec.lvo
  31.         Include    lvo:Dos.lvo
  32.         Include    lvo:Intuition.lvo
  33.         Include    lvo:Graphics.lvo
  34.         Include    lvo:DFunc.lvo
  35.  
  36.         Incdir    inc:
  37.  
  38.         Include    Digital.macs
  39.         Include    Digital.i
  40.         Include    DFunc/DFunc.i
  41.  
  42.         Include    Startup.asm
  43.  
  44.         Incdir
  45.  
  46.     dc.b    "$VER: StripCom 1.0 (1.10.95)",0
  47.  
  48.         even
  49. *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  50. Init        DefLib    dfunc,37
  51.         DefEnd
  52.  
  53. Start        NextArg
  54.         beq.w    About
  55.  
  56.         move.l    d0,a0
  57.         cmp.b    #'?',(a0)
  58.         beq.w    About
  59.  
  60.         lea    IBuff(pc),a1
  61. .copyI        move.b    (a0)+,(a1)+
  62.         tst.b    -1(a0)
  63.         bne.b    .copyI
  64.  
  65. .nextArg1    NextArg
  66.         beq.b    Do
  67.  
  68.         move.l    d0,a0
  69.         tst.b    1(a0)
  70.         beq.b    .Arg1
  71.  
  72.         st    OutFile
  73.  
  74.         move.l    d0,a0
  75.         lea    OBuff(pc),a1
  76. .copyO        move.b    (a0)+,(a1)+
  77.         tst.b    -1(a0)
  78.         bne.b    .copyO
  79.  
  80. .nextArg2    NextArg
  81.         beq.b    Do
  82.  
  83.         move.l    d0,a0
  84.  
  85. .Arg1        cmp.b    #'0',(a0)
  86.         bne.b    .arg2
  87.         moveq    #0,d0
  88.         bra.b    Do
  89.  
  90. .Arg2        cmp.b    #'1',(a0)
  91.         bne.b    .arg3
  92.         moveq    #1,d0
  93.         bra.b    Do
  94.  
  95. .Arg3        cmp.b    #'2',(a0)
  96.         bne.b    .arg4
  97.         moveq    #2,d0
  98.         bra.b    Do
  99.  
  100. .Arg4        cmp.b    #'3',(a0)
  101.         bne.b    .Arg5
  102.         moveq    #3,d0
  103.         bra.b    Do
  104.  
  105. .Arg5        moveq    #0,d0
  106.  
  107. Do        move.l    d0,Mode
  108.  
  109.         LibBase    dfunc
  110.  
  111.         lea    IBuff(pc),a0
  112.         DCall    LoadFile
  113.         move.l    d1,Length
  114.         move.l    d0,File
  115.         beq.b    Error1
  116.  
  117.         move.l    $4.w,a6
  118.         move.l    d1,d0
  119.         move.l    #$10001,d1
  120.         Call    AllocMem
  121.  
  122.         LibBase    dfunc
  123.  
  124.         move.l    d0,MPtr
  125.         beq.b    Error2
  126.  
  127.         move.l    File(pc),a0
  128.         move.l    MPtr(pc),a1
  129.         move.l    Mode(pc),d0
  130.         DCall    StripText
  131.         move.l    d0,NLength
  132.  
  133.         lea    IBuff(pc),a0
  134.  
  135.         tst.b    OutFile
  136.         beq.b    .saveSame
  137.  
  138.         lea    OBuff(pc),a0
  139.  
  140. .saveSame    move.l    MPtr(pc),a1
  141.         move.l    NLength(pc),d0
  142.         DCall    SaveBuffer
  143.         tst.l    d0
  144.         beq.b    Error3
  145.  
  146. *·············································································*
  147. Close        move.l    File(pc),d0
  148.         beq.b    .noFile
  149.         move.l    d0,a0
  150.         DCall    RemFile
  151.  
  152. .noFile        move.l    $4.w,a6
  153.         move.l    MPtr(pc),d0
  154.         beq.b    .noMem
  155.         move.l    d0,a1
  156.         move.l    Length(pc),d0
  157.         Call    FreeMem
  158.  
  159. .noMem        Return    0
  160. *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  161. Error1        lea    Err1(pc),a0
  162.         DCall    WriteStd
  163.         bra.b    Close
  164. *·············································································*
  165. Error2        lea    Err2(pc),a0
  166.         DCall    WriteStd
  167.         bra.b    Close
  168. *·············································································*
  169. Error3        lea    Err3(pc),a0
  170.         DCall    WriteStd
  171.         bra.b    Close
  172. *·············································································*
  173. About        LibBase    dfunc
  174.         lea    ATxt(pc),a0
  175.         DCall    WriteStd
  176.         bra.b    Close
  177. *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  178. IBuff    dcb.b    108,0
  179. OBuff    dcb.b    108,0
  180. Length    dc.l    0
  181. NLength    dc.l    0
  182. Mode    dc.l    0
  183. File    dc.l    0
  184. MPtr    dc.l    0
  185. Err1    dc.b    "Error: Can't open infile!",10,0
  186. Err2    dc.b    "Error: Can't allocate memory!",10,0
  187. Err3    dc.b    "Error: Can't open outfile!",10,0
  188. Atxt    incbin    data:text/StripCom.txt
  189. OutFile    dc.b    0
  190. *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  191.